<template>
  <div :id="echartsId" :style="{width:width,height:height}"></div>
</template>

<script>
export default {
  props: {
    echartsId: {
      type: String,
      default: 'echartsId'
    },
    options: {
      type: Object,
      default: () => { }
    },
    width: {
      type: String,
      default: '300px'
    },
    height: {
      type: String,
      default: '200px'
    }
  },
  methods: {
    init () {
      const myChart = this.$echarts.init(document.getElementById(this.echartsId));
      myChart.setOption(this.options)
      return myChart
    }
  }
}
</script>

<style>
</style>
